package com.sleep.dao.impl;

import com.sleep.dao.IUserDeviceDao;
import com.sleep.model.UserDeviceInfoEntity;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by William on 2017/4/17.
 */

@Repository
public class UserDeviceDaoImpl extends BaseDaoImpl <UserDeviceInfoEntity, Serializable> implements IUserDeviceDao {

    private List<UserDeviceInfoEntity> userDeviceList = new ArrayList<>();

    @Override
    public List<UserDeviceInfoEntity> queryDevice(String userId) {

        Map<String, Object> params = new HashMap<>();

        params.put("userId", userId);

        String hql = "FROM UserDeviceInfoEntity userDevice WHERE userDevice.iUserId=:userId";

        userDeviceList = find(hql, params);

        return userDeviceList;

    }
}
